
	******************************************************************
	**
	**
	**		NAME:		GUY GROSSMAN, YOTAM MARGALIT, TAMAR MITTS
	**		DATE: 		December 15, 2021
	**		PROJECT: 	Israel Hayom
	**		DETAILS: 	This code generates Table SI-8
	**		Version: 	Stata MP 16
	**
	******************************************************************
	
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**
			**	**	**	**	**	**	**	**	**	**	**	**	**

clear
version 16
set scheme plotplain
set more off

capture cd "~/dropbox/Israeli Newspapers Study/JOP_REPLICATION/Dataverse submission"

* bring in period dataset at locality level

use "Data/yeshuv_period_final_Figs.dta", clear
tsset uniqueid period
sort uniqueid period
	
// define covariates
gl interactions i.period#c.ltd i.period#c.lpop i.period#c.matriccert_pcnt_08 i.period#c.europe_pcnt_08 i.period#c.pop_share1829 i.period#c.pop_share3049 i.period#c.pop_share5065 i.period#c.pop_share66 i.period#c.religion_pcnt i.period#c.asia_pcnt_08
su $interactions

gl covs ltd lpop matriccert_pcnt_08 europe_pcnt_08 pop_share1829 pop_share3049 pop_share5065 pop_share66 asia_pcnt_08 religion_pcnt
su $covs

*********************************************************************************************************************************
* Regression for the two-period FD with inverse hyperbolic sine (IHS transformation) Israel-Hayom exposure - dropping Bnei Brak *
*********************************************************************************************************************************

estimates drop _all

foreach var in BRB { 

* OLS model for 2009 - No covariates

bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: reg `var'D1 IHE `var'Pre if period==2 & area_num!=2 [aw=potential], cl(area_num)
	estadd local Model "OLS"
	estadd local covs "no"
	estadd local base "yes"
	capture est sto `var'7
	
* OLS model for 2009 - With covariates
		
bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: reg `var'D1 IHE `var'Pre $covs if period==2 & area_num!=2 [aw=potential], cl(area_num)
	estadd local Model "OLS"
	estadd local covs "yes"
	estadd local base "yes"
	capture est sto `var'8
	
* OLS model for 2013 - No covariates

bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: reg `var'D2 IHE `var'Pre if period==3 & area_num!=2 [aw=potential], cl(area_num)
	estadd local Model "OLS"
	estadd local covs "no"
	estadd local base "yes"
	capture est sto `var'9
	
* OLS model for 2013 - With covariates

bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: reg `var'D2 IHE `var'Pre $covs if period==3 & area_num!=2 [aw=potential], cl(area_num)
	estadd local Model "OLS"
	estadd local covs "yes"
	estadd local base "yes"
	capture est sto `var'10	
	
* OLS model for 2015 - No covariates
	
bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: reg `var'D3 IHE `var'Pre if period==4 & area_num!=2 [aw=potential], cl(area_num)
	estadd local Model "OLS"
	estadd local covs "no"
	estadd local base "yes"
	capture est sto `var'11
	
* OLS model for 2015 - With covariates

bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: reg `var'D3 IHE `var'Pre $covs if period==4 & area_num!=2 [aw=potential], cl(area_num)
	estadd local Model "OLS"
	estadd local covs "yes"
	estadd local base "yes"
	capture est sto `var'12	
	
* IV model for 2009 - No covariates
	
bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: ivreg2 `var'D1 (IHE = IVsm) `var'Pre if period==2 & area_num!=2 [aw=potential],  cl(area_num)
	estadd local Model "IV"
	estadd local covs "no"
	estadd local base "yes"
	capture est sto `var'IVsm7
	
* IV model for 2009 - With covariates
		
bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: ivreg2 `var'D1 (IHE = IVsm) `var'Pre $covs if period==2 & area_num!=2 [aw=potential],  cl(area_num)
	estadd local Model "IV"
	estadd local covs "yes"
	estadd local base "yes"
	capture est sto `var'IVsm8
	
* IV model for 2013 - No covariates
	
bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: ivreg2 `var'D2 (IHE = IVsm) `var'Pre if period==3 & area_num!=2 [aw=potential],  cl(area_num)
	estadd local Model "IV"
	estadd local covs "no"
	estadd local base "yes"
	capture est sto `var'IVsm9
	
* IV model for 2013 - With covariates
		
bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: ivreg2 `var'D2 (IHE = IVsm) `var'Pre $covs if period==3 & area_num!=2 [aw=potential],  cl(area_num)
	estadd local Model "IV"
	estadd local covs "yes"
	estadd local base "yes"
	capture est sto `var'IVsm10
	
* IV model for 2015 - No covariates
			
bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: ivreg2 `var'D3 (IHE = IVsm) `var'Pre if period==4 & area_num!=2 [aw=potential],  cl(area_num)
	estadd local Model "IV"	
	estadd local covs "no"
	estadd local base "yes"
	capture est sto `var'IVsm11
	
* IV model for 2015 - With covariates

bootstrap, reps(250) seed(1712) cl(area_num) idcl(new_area_num) group(uniqueid) force: ivreg2 `var'D3 (IHE = IVsm) `var'Pre $covs if period==4 & area_num!=2 [aw=potential],  cl(area_num)
	estadd local Model "IV"
	estadd local covs "yes"
	estadd local base "yes"
	capture est sto `var'IVsm12
	
	}
	
	* Outsheeting results to create Table SI-8

	# delimit ;
	esttab BRB7 BRB8 BRB9 BRB10 BRB11 BRB12 BRBIVsm7 BRBIVsm8 BRBIVsm9 BRBIVsm10 BRBIVsm11 BRBIVsm12
		using "Tables/Table_SI-8.tex", replace
		keep(IHE _cons)
		cells(b(fmt(%5.3f) star) se(fmt(%5.3f) par))
		starlevels(* .10 ** .05 *** .01) 
		mgroups( "\textbf{2009}" "\textbf{2013}" "\textbf{2015}" "\textbf{2009}" "\textbf{2013}" "\textbf{2015}", 
		pattern(1 0 1 0 1 0 1 0 1 0 1 0)
		span prefix(\multicolumn{@span}{c}{) suffix(}) erepeat(\cmidrule(lr){@span})) nomtitles
		varlabels(IHE "IH exposure" _cons "Constant")
		stats(Model covs base r2 N, labels("Model" "Covariates" "Base DV" "R2" "N")
		fmt(0 0 0 2 0)) collabels(none) label booktabs nonotes
		;
		#delimit cr	
		
